<?php 
/**
 * @author Eugenio Fage
 * http://eugeniofage.wordpress.com/
 * http://code.google.com/p/monky/
 * 
 */
?>
<div class="whitebox">
<table cellspacing="0" border="0" summary="<? __('Whats happening?') ?>">
  <caption style="font-size:30px;color:red;font-weight:bold"><? __('Whats happening?') ?></caption>
  <thead>
    <tr>
      <th><? __('When?') ?></th>
      <th><? __('Action') ?></th>
      <th><? __('Link') ?></th>
      <th><? __('Who?') ?></th>
      <th><? __('Status') ?></th>
    </tr>
  </thead>
  <tbody>
<? foreach ($Logs as $l) :

	if(isset($l['comment'])){
		$link=$this->Html->link($l['link']['title'],array('controller'=>'comments','action'=>'redirectToLinkComment','slug'=>Inflector::slug($l['link']['title']),'linkid'=>$l['link']['id'],'id'=>$l['comment']['id']));
	}else{
		$link=$this->Html->link($l['link']['title'],array('controller'=>'links','action'=>'view','slug'=>Inflector::slug($l['link']['title']),'id'=>$l['link']['id']));
	}
	
	$whoLink='---';
	if(isset($l['who'])){
		$whoLink=$this->Html->link($l['who']['username'],array('controller'=>'users','action'=>'view',$l['who']['id']));
	}
	
	if($l['link']['status']=='published'){
		$status=__('Published',true);
	}	else{
		$status=__('Pending',true);
	}
?>
	<tr>
	  <td><?=$this->Time->timeAgoInWords($l['date']) ?></td>
	  <td><?=$l['action'] ?></td>
	  <td><?=$link ?></td>
	  <td><?=$whoLink ?></td>
	  <td><?=$status ?></td>
	</tr>	
<?php endforeach; ?>
	</tbody></table>
</div>